package chances.system.model;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class ResultSetModel<T> {
	private List<T> resultSet;
	private Object pageInfo;
	
	
	public ResultSetModel(List<T> details) {
		this.setResultSet(details);
	}
	
	List<LookupModel> lookups = new ArrayList<LookupModel>();

	public void addLookup(String name, Map<String, String> values) {
		this.lookups.add(new LookupModel(name, values));
	}
	
	public Map<String, String> getLookup(String name) {
		for (LookupModel lookupModel : lookups) {
			if (lookupModel.getName().equals(name)) {
				return lookupModel.getValues();
			}
		}
		return new HashMap<String, String>();
	}

	public List<T> getResultSet() {
		return resultSet;
	}

	public void setResultSet(List<T> resultSet) {
		this.resultSet = resultSet;
	}

	public Object getPageInfo() {
		return pageInfo;
	}

	public void setPageInfo(Object pageInfo) {
		this.pageInfo = pageInfo;
	}

	public List<LookupModel> getLookups() {
		return lookups;
	}

}
